package secondriver.springsubway.example.rpv.result;


import secondriver.springsubway.example.rpv.ErrorDesc;
import secondriver.springsubway.example.rpv.ParameterValidatorResult;

import java.util.Collections;
import java.util.List;

/**
 * Created by ZhangXiao on 2015/6/11.
 */
public class DefaultParameterValidatorResult implements ParameterValidatorResult {

    private List<ErrorDesc> values = Collections.EMPTY_LIST;

    private Object parameterBean;

    public DefaultParameterValidatorResult(Object parameterBean) {
        this.parameterBean = parameterBean;
    }

    public DefaultParameterValidatorResult(List<ErrorDesc> values, Object parameterBean) {
        if (null != values) {
            this.values = values;
        }
        this.parameterBean = parameterBean;
    }

    public List<ErrorDesc> errorDesc() {
        return values;
    }

    public boolean hasInvalidParameter() {
        return !values.isEmpty();
    }

    public Object getParameterBean() {
        return parameterBean;
    }
}